package com.bkq.cb;

import com.bkq.cb.BLO.ReturnCustomReport;
import com.bkq.cb.BLO.ReturnDayReport;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class CustomReport extends Activity {
	private Button back;
	ReturnCustomReport cp = new ReturnCustomReport(this);
	private TextView today,moneyIn,moneyEx,moneyBaTra,moneyLo,moneyDe,moneyBaLo;
	String idUser,nameUser,value,dayFrom,dayTo;
	public void onCreate(Bundle savedInstanceState) {
		 super.onCreate(savedInstanceState);
	     setContentView(R.layout.reportcustom);
	     today = (TextView)findViewById(R.id.today1_ReportCustom);
	     back = (Button)findViewById(R.id.backIma_ReportCustom);
	     moneyIn = (TextView)findViewById(R.id.moneyIn_CustomReport);
	     moneyEx = (TextView)findViewById(R.id.moneyEx_CustomReport);
	     moneyBaTra = (TextView)findViewById(R.id.moneyBanTran_CustomReport);
	     moneyLo = (TextView)findViewById(R.id.moneyLo_CustomReport);
	    
	     moneyDe = (TextView)findViewById(R.id.moneyDe_CustomReport);
	     moneyBaLo = (TextView)findViewById(R.id.moneyBanLoan_CustomReport);
	     Bundle extras = getIntent().getExtras();
         if(extras!=null)
	     {
	    idUser = extras.getString("idUser").toString();
	    nameUser = extras.getString("nameUser").toString();
	    dayFrom = extras.getString("day").toString();
	    dayTo = extras.getString("dayTo").toString();
	  //  value = extras.getString("today").toString();
	     }
         if(dayFrom.equals(dayTo))today.setText(dayFrom);
         else today.setText(dayFrom+" - "+dayTo);
	     back.setOnClickListener(new View.OnClickListener() {
	 			
	 			@Override
	 			public void onClick(View v) {
	 				// TODO Auto-generated method stub
	 				Intent i = new Intent(CustomReport.this,SelectModeReport.class);
	 				i.putExtra("idUser", idUser);
					i.putExtra("nameUser", nameUser);
					startActivity(i);
	 			}
	 		});
	     float[]s=new float[6];
	     s=cp.getValue(dayFrom, dayTo, idUser);
	     moneyIn.setText(String.valueOf(s[0]));
         moneyEx.setText(String.valueOf(s[1]));
         moneyBaTra.setText(String.valueOf(s[2]));
         moneyLo.setText(String.valueOf(s[3]));
         moneyDe.setText(String.valueOf(s[4]));
         moneyBaLo.setText(String.valueOf(s[5]));
      
	}
}
